package Bug;

import java.io.File;
import java.io.FilePermission;
import java.security.AccessController;
import java.security.Permission;

public class FileAccessDemo {

    public static void main(String[] args) {
        // 要检查的路径
        String path = "D:/tmp/upload/conf/test2.txt";
        File file = new File(path);
        if (file.canWrite()) {
            System.out.println("具有对路径 " + path + " 的写权限");
        } else {
            System.out.println("没有对路径 " + path + " 的写权限");
        }

    }
}